#ifndef MYCLIENTSOCKET_H
#define MYCLIENTSOCKET_H

#include <QTcpSocket>
#include <QThread>
#include <QTimer>
#include <QMap>
#include <QTextCodec>
#include <QByteArray>
#include <QDateTime>
#include "databaseclass.h"

class myClientSocket : public QTcpSocket
{
    Q_OBJECT
public:
    explicit myClientSocket(databaseClass *db,QObject *parent = 0,int clientID=0);
   ~myClientSocket();
  //QString send_open_str;
private:
    int clientID;
    //QThread *th;
    databaseClass *myclassdb;
    QTimer *Download_timer,*Delete_timer,*Voice_timer, *Send_timer;

    QString my_dev_flag;
    QString my_dev_id;
    QString myClient_card_no,myDelet_card_no;
    //bool Client_flag;
    conInfo *MyPersonInfo;

    boxIdInfo Sninfo;
    bool down_falg;//下载删除标志
    bool TIMER_falg;//门禁设备心跳包标志

    //int IdAddCount,IdDelCount;
    //int CurrentDownId;
    //int CurrentDeleteId;
    //QString HouseAddId,HouseDelId;
    //QMap<int ,QString> houseAddMap;
    //QMap<int ,QString> houseDelMap;
    QString OpenDoorData;
    QDateTime OpenTime;
    houseInfo house;
    int del_num,dow_num;
signals:
    void ClientReadData(int clientID,QString IP,int Port,QByteArray data);
    void ClientDisConnect(int clientID,QString IP,int Port);
    void openClientDoorSend(QString send);
    
private slots:
    void ReadData();
    void DisConnect();
    bool Download_netdata();
    void Delete_netdata();
   // void Send_netdata();
    void Voice_netdata();
    //void Client_netdata();
    QString DateBack();

public slots:
   void OpenDoorSlot(QString);
    //void mjHouseId(QString dev_no);
   //void  mjCheckId(QString flag);
   void Send_netdata();
   void Num_netdata(QString ,QString);
};

#endif // MYCLIENTSOCKET_H
